package com.sgcc.manager.sql.biz.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.jdbc.core.JdbcTemplate;

import com.sgcc.manager.sql.vo.JdbcTemplateUtil;


public class SessionDBUtil {
	public static Map<String,JdbcTemplateUtil> map=new HashMap<String,JdbcTemplateUtil>();

	public static void add(String sessionId, JdbcTemplateUtil jdbcDom) {
		map.put(sessionId, jdbcDom);
		System.out.println("mapchangdu------"+map.size());
	}
	
	public static JdbcTemplateUtil get(String sessionId) throws Exception{
		JdbcTemplateUtil jdbcTemplateUtil=null;
		jdbcTemplateUtil=map.get(sessionId);
		if(jdbcTemplateUtil==null){
			throw new Exception("请先连接数据库");
		}
		return jdbcTemplateUtil;
	}
	
}
